#include "enemybullet.h"

EnemyBullet::EnemyBullet()
{
    //初始化坐标
       m_x=100;
       m_y=100;
       //初始化图片
       m_Enemy_Bullet.load(ENEMY_BULLET_PATH);

       //子弹状态
       m_Free=1;//默认空闲

       //子弹速度
       m_Speed=ENEMY_BULLET_SPEED;

       //子弹边框
       m_rect.setWidth(m_Enemy_Bullet.width());
       m_rect.setHeight(m_Enemy_Bullet.height());
       m_rect.moveTo(m_x,m_y);
}
void EnemyBullet::update_Enemy_Bullet_Position()
{
    //空闲状态下的子弹，不需要计算坐标
    if(m_Free==1)
    {
        return;
    }
    //子弹向下移动
    else
    {
        m_y+=m_Speed;
        m_rect.moveTo(m_x,m_y);
        if(m_y>=(m_rect.height()+GAME_HEIGHT))
        {
            m_Free=1;
        }
    }
}
